package com.helloniu.wb.tools {

import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;

public class LineResizeBox extends ResizeBox {
    public function LineResizeBox() {
        super();
        buttonMode = useHandCursor = true;
    }

    public function setStartPoint(sp:Point):void {
        startP = sp;
    }

    public function setEndPoint(ep:Point):void {
        endP = ep;
    }

    public function getResizeType():Number {
        return resizeType;
    }

    override protected function updateDisplayList(uw:Number, uh:Number):void {
        super.updateDisplayList(uw, uh);

        if(this.stage == null || startP == null || endP == null) {
            return;
        }

        with(graphics) {
            clear();
            lineStyle(1, getStyle("themeColor"), 0.5);
            beginFill(0xffffff, 0.5);

            rectArr = new Array();
            // 0
            moveTo(startP.x - 5, startP.y - 5);
            rectArr.push(new Rectangle(startP.x - 5, startP.y - 5, 10, 10));
            drawRect(startP.x - 5, startP.y - 5, 10, 10);
            // 1
            moveTo(endP.x - 5, endP.y - 5);
            rectArr.push(new Rectangle(endP.x - 5, endP.y - 5, 10, 10));
            drawRect(endP.x - 5, endP.y - 5, 10, 10);
            endFill();
        }
    }

    private var endP:Point;
}
}